import createAxios from './axios'

// 全局代理
const PROXY_PATH = '/api'


// 提交换房申请申请路径
const APPLY_EXROOM_PATH = '/stu/insertExchangeInfo'

// 获取本栋卫生检查记录路径
const SANITARY_PATH = '/stu/getHygOne'


// 获取我的报修信息
const REPAIR_LOG_PATH = '/stu/getRepairSelfRoom'

// 撤销报修申请
const DEL_REPAIR_PATH = '/stu/deleteRepairByStu'

// 修改报修内容
const MOD_REPAIR_TXT_PATH = '/stu/updateRepairByStu'

// 提交报修申请内容
const SUB_REPAIR_PATH = '/stu/addRepairByStu'

// 申请离校路径
const APPLY_LEAVE_PATH = '/stu/applyHolLeave'

// 申请留校路径
const APPLY_STAY_PATH = '/stu/applyHolOn'

// 撤销留校申请
const DEL_STAY_SCH_PATH = '/stu/applyDeleteOn'

// 获取本人申请记录
const GET_APPLY_PATH = '/stu/getHolByStu'

// 学生预约公共设施
const APPLY_PUBLIC_PATH = '/stu/appointmentPublic'

//学生获取公共设施情况
const GET_PUBLIC_INFO_PATH = '/stu/getPublicByStu'

// 模糊查询，本栋楼层的公共设施
const GET_QUERRY_PUBLIC_PATH = '/stu/getPublicOneName'

// 学生获取公告路径
const GET_NOTICE_PATH = '/stu/getNoticeByStu'

// -------- 登录界面请求 --------------
export const loginSystem = (url, data) => createAxios('get', PROXY_PATH + url, data)

// 注册界面请求
export const registUser = (url, data) => createAxios('post', PROXY_PATH + url, data)

// -------- 学生界面请求 --------------

// === AdminHome组件中--- 获取登录用户信息
export const getUserInfo = (url) => createAxios('get', PROXY_PATH + url)

//===PersonalCenter组件中
// 修改、完善个人信息
export const changeStuInfo = (data) => createAxios('post', PROXY_PATH + '/stu/changeStuInfo', data)

// ===ChangeDomitory组件中
// 查询可选的楼栋信息
export const searchAvailBuild = () => createAxios('get', PROXY_PATH + BUILD_PATH, {})
// 根据寝室号查询寝室人数信息
export const getPersonNumByRoomId = (roomId) => createAxios('get', PROXY_PATH + PERSON_NUM_PATH, roomId)
// 提交换房申请申请
export const submitApplyInfo = (data) => createAxios('post', PROXY_PATH + APPLY_EXROOM_PATH, data)

// ===SanitaryExamination组件中
// 获取本栋卫生检查记录
export const getSanitaryLog = ({ currentPage, pageSize }) =>
	createAxios('get', PROXY_PATH + SANITARY_PATH, { currentPage, pageSize })
// 按照寝室号进行查询
export const getSanitaryLogByRoomId = (data) => createAxios('get', PROXY_PATH + QURRY_PATH, data)

// ==MyDomitory 组件中
// 1.学生查看自己的换房申请
export const queryExchangeInfoByStu = ({ currentPage }) =>
	createAxios('get', PROXY_PATH + '/stu/queryExchangeInfoByStu', { currentPage })
// 2.撤回换房申请
export const deleteExchangeInfoByStu = ({ changeId }) =>
	createAxios('post', PROXY_PATH + '/stu/deleteExchangeInfoByStu', { changeId })


// ===MyRepairs.vue组件中
// 获取我的报修记录
export const getMyRepairHistory = ({ currentPage, pageSize }) =>
	createAxios('get', PROXY_PATH + REPAIR_LOG_PATH, { currentPage, pageSize })
// 在报修审核通过之前可以撤销报修申请
export const delRepairApply = (data) => createAxios('get', PROXY_PATH + DEL_REPAIR_PATH, data)
// 在报修申请通过之前可以修改报修内容
export const modRepairApply = (data) => createAxios('get', PROXY_PATH + MOD_REPAIR_TXT_PATH, data)

// ==MyRepairReply组件中

// 提交报修申请
export const submitRepairApply = ({ repairContent, phone }) =>
	createAxios('post', PROXY_PATH + SUB_REPAIR_PATH, { repairContent, phone })

// 返校状态更换
export const stuBackSchool=({holReason})=>createAxios("get",PROXY_PATH+"/stu/stuBackSchool",{holReason})
// 申请离校
export const ApplyLeaveSchool = ({ holReason }) => createAxios('post', PROXY_PATH + APPLY_LEAVE_PATH, { holReason })
// 申请留校
export const ApplyStaySchool = ({ holReason }) => createAxios('post', PROXY_PATH + APPLY_STAY_PATH, { holReason })
// 撤销留校申请
export const delStaySchoolApply = () => createAxios('post', PROXY_PATH + DEL_STAY_SCH_PATH, {})
// 获取自己的申请信息
export const getApplyInfo = () => createAxios('get', PROXY_PATH + GET_APPLY_PATH, {})

// electricity_fee电费缴纳模块
// 学生缴纳电费信息
export const updateElectric = ({ stuId, stuName, buildId, dormitory, electric }) =>
	createAxios('post', PROXY_PATH + '/stu/updateElectric', { stuId, stuName, buildId, dormitory, electric })

// ==PublicSubscribe组件
// 预约公共设施
export const applyPublicSubscribe = ({ publicTime, publicId }) =>
	createAxios('GET', PROXY_PATH + APPLY_PUBLIC_PATH, { publicTime, publicId })
// 获取公共设施
export const getPublicInfo = ({ currentPage, pageSize }) =>
	createAxios('get', PROXY_PATH + GET_PUBLIC_INFO_PATH, { currentPage, pageSize })
// 模糊查询-更具公共设施名称获取
export const getPublicInfoByName = (data) => createAxios('get', PROXY_PATH + GET_QUERRY_PUBLIC_PATH, data)

// 获取公告
export const getNoticeList = ({ currentPage, pageSize }) =>
	createAxios('get', PROXY_PATH + GET_NOTICE_PATH, { currentPage, pageSize })

// 留言
// 1.获取留言
export const queryMessageOneSelf = ({ currentPage, pageSize }) =>
	createAxios('get', PROXY_PATH + '/stu/queryMessageOneSelf', { currentPage, pageSize })
// 2.获取自己留言的详细信息
export const queryMessageStuDetail = ({ msgId }) =>
	createAxios('get', PROXY_PATH + '/stu/queryMessageStuDetail', { msgId })
// 3.修改留言
export const updateMessageInfoByStu = ({ msgId, content }) =>
	createAxios('get', PROXY_PATH + '/stu/updateMessageInfoByStu', { msgId, content })
// 4.学生撤销留言
export const deleteMessageInfoByStu = ({ msgId }) =>
	createAxios('get', PROXY_PATH + '/stu/deleteMessageInfoByStu', { msgId })
// 5.发布留言
export const addMessageInfoByStu = ({ content }) =>
	createAxios('post', PROXY_PATH + '/stu/addMessageInfoByStu', { content })
